﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

/// <summary>
/// UploadFileDB 上传文件数据类
/// </summary>
public class UploadFileDB : DataLayer
{
	public UploadFileDB()
	{
		clsDB = new DBOperating();
		clsConfig = new Configuration();

		nIDNumber = 0;
		nStatusNumber = 8;
		strTableName = "UploadFile";
		nColumnNumber = 11;

		arrTableColumnName = new string[nColumnNumber];
		arrTableColumnValue = new string[nColumnNumber];

		arrTableColumnName[0] = "UploadFile_ID";
		arrTableColumnName[1] = "UploadFile_FileName";
		arrTableColumnName[2] = "UploadFile_Path";
		arrTableColumnName[3] = "UploadFile_ColumnID";
		arrTableColumnName[4] = "UploadFile_ShowDate";
		arrTableColumnName[5] = "UploadFile_DateTime";
		arrTableColumnName[6] = "UploadFile_Count";
		arrTableColumnName[7] = "UploadFile_UserID";
		arrTableColumnName[8] = "UploadFile_Status";
		arrTableColumnName[9] = "UploadFile_Content";
		arrTableColumnName[10]= "UploadFile_Type";
	}

	#region 查询

	/// <summary>
	/// 根据上传文件所属的栏目查询
	/// </summary>
	/**********************************************************************************************
	 ** 功能描述：	根据上传文件所属的栏目查询，未包含其下级栏目的文件
	 ** 输入参数：	int nColumnID		上传文件所属栏目
	 ** 返回值：
	 ** 作者：	Tony Mucor
	 ** 日期：	2013-08-15
	 ** 修改：
	 ** 日期：
	 *********************************************************************************************/
	public DataTable QueryFiles(int nColumnID)
	{
		string strSQL;

		strSQL = "SELECT * FROM UploadFile WHERE UploadFile_Status = '" + clsConfig.nNormal.ToString() + "' AND UploadFile_ColumnID = '" + nColumnID.ToString() + "' ORDER BY CAST(UploadFile_ShowDate AS DATETIME) DESC, UploadFile_ID DESC";
		return QueryToDataTable(strSQL);
	}

	#endregion
}
